package com.koron.standard.patrolLine.bean.excel;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.koron.common.core.util.CodeTools;
import com.koron.standard.patrolLine.bean.po.LinePatrol;
import com.koron.standard.patrolLine.bean.po.LinePatrolCheck;
import com.koron.standard.patrolLine.bean.po.LinePatrolRecord;
import lombok.Data;

/**
 * @author jzp
 * @since 2022/5/16
 */
@ExcelIgnoreUnannotated
@Data
public class LinePatrolExcel {

    // @ExcelProperty(value = "设备分类编码，转化为设备分类id")
    @ExcelProperty(index = 0)
    private String typeId;

    // @ExcelProperty(value = "设备分类名称")
    @ExcelProperty(index = 1)
    private String typeName;

    // @ExcelProperty(value = "标题")
    @ExcelProperty(index = 2)
    private String name;

    // @ApiModelProperty("检查项-名称")
    @ExcelProperty(index = 3)
    private String checkName;

    // @ApiModelProperty("检查项-标准")
    @ExcelProperty(index = 4)
    private String checkContent;

    // @ApiModelProperty("记录项名称")
    @ExcelProperty(index = 5)
    private String recordName;

    // @ApiModelProperty("记录项单位")
    @ExcelProperty(index = 6)
    private String recordUnit;

    // @ApiModelProperty("标准类型，standard_patrol_type")
    @ExcelProperty(index = 7)
    private String standardType;

    public LinePatrol buildPatrol() {
        LinePatrol linePatrol = new LinePatrol();
        linePatrol.setId(CodeTools.getCode32());
        linePatrol.setName(name);
        linePatrol.setTypeId(typeId);
        linePatrol.setPublicStatus(0);
        linePatrol.setStatus(1);
        linePatrol.setStandardType(standardType);
        // code, appid, sort
        return linePatrol;
    }

    public LinePatrolCheck buildPatrolCheck(String patrolId, Integer sort, Integer checkStatus) {
        LinePatrolCheck check = new LinePatrolCheck();
        check.setPatrolId(patrolId);
        check.setName(checkName);
        check.setContent(checkContent);
        check.setSort(sort);
        return check;
    }

    public LinePatrolRecord buildPatrolRecord(String patrolId, Integer sort, Integer recordStatus) {
        LinePatrolRecord record = new LinePatrolRecord();
        record.setPatrolId(patrolId);
        record.setName(recordName);
        record.setUnit(recordUnit);
        record.setSort(sort);
        return record;
    }

}
